<?php

/**
 *
 *
 * @version $Id$
 * @copyright 2011
 */
require_once("classes\class.Parser.php");
require_once("classes\class.Collection.php");
require_once("classes\class.Reflector.php");

//$att = "var= \"name\" 1\" item='item' from=item";
$att = "var= \"name 1\" item='item' from=item";
$name = array("fdfd", "fdfdfd", "fdfdfd");
$itr = new Collection($name);

$attrs = TagAttrParser::parse($att);
print_r($attrs);
echo("<br >Collection is subclass of Iterator=" . (is_subclass_of($itr, "Iterator") ? "True":"False") . "<br />");
echo("Collection's Parent=" . get_parent_class($itr));
$ref = new ReflectionClass(get_class($itr));
$itf = $ref->getInterfaceNames();
$ref = new RadReflector($itr);
echo($ref->hasInterface("Iterator") ? "True":"False");

	function getValue($name) {
		$key = strtolower($name);
		$index = -1;
		$posOpen = stripos($key, "[");
		$posClose = stripos($key, "]");
		$len = strlen($key);
		if ( $posOpen > 0 && $posClose === $len - 1) {
			$index = intval(substr($key, $posOpen + 1, $len - $posOpen - 2));
			echo("<br />Key=" . substr($key, 0, $posOpen) . "<br />");
		}
		return $index;
	}
	echo("<br/>Index=" . getValue("Index[50]") . "<br />");

	$var = TemplateVarParser::parse("name['url' ] ['port'     ]");
	var_dump($var);
?>